package com.ccp.dev.qbdms.controller;

import com.ccp.dev.core.basic.annotion.Action;
import com.ccp.dev.core.basic.model.SysAuditModelType;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
@Controller
@Action(ownermodel = SysAuditModelType.LOGIN_MANAGEMENT)
public class CustomLoginController {


    @Value("${login.useValidCode}")
    private Boolean useValidCode = true;

    @RequestMapping({"/qbdmslogin"})
    public ModelAndView login(HttpServletRequest request) {
        SecurityContextHolder.clearContext();
        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("ctx", request.getContextPath());
        modelAndView.addObject("useValidCode", useValidCode);
        modelAndView.setViewName("login");
        return modelAndView;
    }
}
